package Decorateur;

import Composite.RacineDossier;
import Composite.Element;
import fichiers.*;
import espace_physique.*;
import java.awt.Component;
import java.io.File;
import javax.swing.*;



public class MyIconListCellRender implements ListCellRenderer{
    
    private ListCellRenderer next;

    
    public MyIconListCellRender(ListCellRenderer next) {
        
        this.next=next;
        
    }
    
    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
        
        Element e=RacineDossier.getRacine().getElement((String)value);
        JLabel c=(JLabel)next.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
        File f=e.getFichierCourant();
        c.setIcon(e.getRepresentation());

        
        c.setText(f.getAbsolutePath());
        return c;
    }
    
}
